<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('列表')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="operlog-form">
					<div class="select-list">
						<ul>
							<li>
								业务订单号：<input type="text" name="params[businessOrderNO]"/>
							</li>
							<li>
								交易订单号：<input type="text" name="params[tradeOrderNo]"/>
							</li>
							<li class="select-time">
								<label>交易时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
			<div class="btn-group-sm" id="toolbar" role="group">
	            <a class="btn btn-warning" onclick="$.table.exportExcel()">
		            <i class="fa fa-download"></i> 导出
		        </a>
	        </div>
	        
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	
	<div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "merchant/order";
        var channel_pay_order_status = [[${@dict.getType('channel_pay_order_status')}]];
        $(function() {
            var options = {
                url: prefix + "/list",
                updateUrl: prefix + "/show/{id}",
		        showFooter: true,
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
                columns: [
				{
					field : 'memberId', 
					title : '商户编号',
					visible: false
				},
				{
					field : 'businessOrderNO', 
					title : '业务订单'
				},
				{
					field : 'tradeOrderNo', 
					title : '交易订单'
				},
				{
					field : 'tradeType', 
					title : '交易类型'
				},
				{
					field : 'payMode', 
					title : '支付方式',
					sortable: true
				},
				{
				    field : 'amount',
				    title : '交易金额',
				    align: 'right',
				    footerFormatter:function (value) {
				    	var total_amount = 0;
				        for (var i in value) {
				        	total_amount = parseFloat(value[i].totalAmount);
				        }
				        return "总金额：<strong style='color: red;'>" + total_amount+"</strong>";
				    }
				},
				{
                    field: 'status',
                    title: '支付状态',
                    align: 'center',
				 	formatter: function(value, row, index) {
				      return $.table.selectDictLabel(channel_pay_order_status, value);
				  	}
                },
                {
                    field: 'payTime',
                    title: '支付时间'
                },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.orderDetailsTab(\'' + row.tradeOrderNo + '\')"></i>详情</a> ');
		                return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>